package Practice08;

import java.util.ArrayList;
import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        // Arrays.toString()
        int[] arr = {1, 23, 4, 3, 42, 5, 23, 623, 62};
        System.out.println(arr);
        String s = Arrays.toString(arr);
        System.out.println(s);
        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
        sortByString();
    }

    public static void sortByString() {
        String str = "asjgljalq'23ejrlajnalssdjflaslga";
        char[] charList = str.toCharArray();
        Arrays.sort(charList);

        ArrayList<Character> chars = new ArrayList<>();

        for (int i = charList.length - 1; i >= 0; i--) {
            System.out.println(charList[i]);
            chars.add(charList[i]);
        }
        System.out.println(chars);
    }
}
